<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSeecmsUserRoleTable extends Migration
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */

    protected $name = 'seecms_user_role';

    public function up()
    {
        Schema::create($this->name, function (Blueprint $table) {
            $table->id();
            $table->string('name')->comment('角色名称');
            $table->text('rule')->comment('角色权限')->nullable();
            $table->text('menu')->comment('角色菜单')->nullable();
            $table->string('description')->comment('description')->default('');
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::dropIfExists($this->name);
    }
}
